package com.unionftech.common.recaptcha.aliyun

import android.content.Context

data class AliyunCaptchaConfig(
    val sceneId: String,
    val prefix: String,
    var context: Context? = null,
    val language: AliyunCaptchaLanguage,
    var listener: AliyunCaptchaListener? = null,
) {
    class Builder {
        private var sceneId: String = ""
        private var prefix: String = ""
        private var language: AliyunCaptchaLanguage = AliyunCaptchaLanguage.cn
        private var listener: AliyunCaptchaListener? = null
        private var context: Context? = null

        fun setSceneId(sceneId: String): Builder {
            this.sceneId = sceneId
            return this
        }

        fun setPrefix(prefix: String): Builder {
            this.prefix = prefix
            return this
        }


        fun setLanguage(language: AliyunCaptchaLanguage): Builder {
            this.language = language
            return this
        }

        fun listener(listener: AliyunCaptchaListener): Builder {
            this.listener = listener
            return this
        }

        fun build(activity: Context): AliyunCaptchaConfig {
            this.context = activity
            return AliyunCaptchaConfig(
                this.sceneId,
                this.prefix,
                this.context,
                this.language,
                this.listener,
            )
        }
    }
}